#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int cmp(int* a, int* b)
{
	return *(int*)a - *(int*)b;
}
int food(int* g, int gSize, int* s, int sSize)
{
	int idx = 0;
	qsort(g, gSize, sizeof(int), cmp);
	qsort(s, sSize, sizeof(int),cmp);
	for (int i = 0; i < sSize; i++)
	{
		if (idx < sSize && s[i] >= g[idx])
		{
			idx++;
		}
	}
	return idx;
}
int main()
{
	int ng, ns;
	int a=0;
	int g[1000] = { 0 }, s[1000] = { 0 };
	int i = 0;
	scanf("%d %d",&ng,&ns);
	
	for (i = 0; i < ng; i++)
	{
		scanf("%d ", &g[i]);
	}
	for (i = 0; i < ns; i++)
	{
		scanf("%d ", &s[i]);
	}
	a = food(g, ng, s, ns);
	printf("%d", a);
}